package me.zk.practice1.hw;

import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

/**
 * 汽水瓶
 * @author zhangkai
 * @date 2023/7/25 15:55
 */
public class S1 {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        List<Integer> inList = new ArrayList<>();
        while (in.hasNextInt()) { // 注意 while 处理多个 case
            int a = in.nextInt();
            if (a==0) {
                break;
            }
            inList.add(a);
        }
        //计算
        for(int i: inList) {
            helper(i);
        }

    }
    //3 //4
    //1 //2

    public static void helper(int i) {
        int a = 0;
        while (i >2) {
            a+=i/3;
            i =i/3 + i %3;
        }
        if (i ==2) {
            a+=1;
        }
        System.out.println(a);
    }
}
